﻿
using FacebookXmpp.Parse;

namespace FacebookXmpp.Stanzas
{
	internal class Session : Stanza
    {
    	public Session() 
    	{
			NextResponse = string.Format( @"<iq id=""{0}"" type=""set"" to=""chat.facebook.com""><session xmlns=""urn:ietf:params:xml:ns:xmpp-session"" /></iq>", NextId );
    	}

		internal override StanzaListenCriteria ListenFor
		{
			get { return new StanzaListenCriteria( "iq", "session", false, StanzaListenCriteria.DefaultResponseTimeMilliseconds * 4 ); }
		}

        public override void ProcessResponse(MessageData recieved)
		{
			Stream.RemoveHandler( this );
			Stream.AddHandler( new Roster( ) );
        }
    }
}
